<template>
  <div class="thinking-indicator" :class="[size]">
    <div v-if="label" class="label">{{ label }}</div>
    <div class="dots-container">
      <div class="dots">
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';

const props = defineProps({
  size: {
    type: String,
    default: 'medium',
    validator: (value) => ['small', 'medium', 'large'].includes(value)
  },
  label: {
    type: String,
    default: '思考中'
  }
});
</script>

<style scoped>
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.label {
  font-size: 14px;
  color: var(--el-text-color-secondary);
}

.dots-container {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}

.dots {
  display: flex;
  gap: 4px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--el-color-primary);
  opacity: 0.7;
}

.dot:nth-child(1) {
  animation: pulse 1.5s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation: pulse 1.5s infinite ease-in-out 0.2s;
}

.dot:nth-child(3) {
  animation: pulse 1.5s infinite ease-in-out 0.4s;
}

.small .dot {
  width: 4px;
  height: 4px;
}

.small .label {
  font-size: 12px;
}

.large .dot {
  width: 8px;
  height: 8px;
}

.large .label {
  font-size: 16px;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
}
</style> 